import requests


class YoudaoTranslation:
    def __init__(self, url='https://aidemo.youdao.com/trans'):
        self.url = url

    def translate(self, text, from_lang='Auto', to_lang='Auto'):
        data = {
            'q': text,
            'from': from_lang,
            'to': to_lang
        }
        res = requests.post(self.url, data=data)
        return res.json()["web"][0]['value']

    # 使用示例


translator = YoudaoTranslation()
translated_text = translator.translate('分销 商家')
print(translated_text)
